﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jayden.Dll.Navigation.Core;

namespace Jayden.Dll.Navigation.Core
{
	public class OneWaySegment : CoreSegment
	{
		private List<CorePathInformation> m_Path = null;

		protected List<CorePathInformation> BuildPath()
		{
			List<CorePathInformation> path = new List<CorePathInformation>();
			for (int c = 1; c < Coordinates.Count; c++)
				BuildPathSegment(path, Coordinates[c - 1], Coordinates[c]);
			return path;
		}
		protected virtual void BuildPathSegment(List<CorePathInformation> path, Coordinate start, Coordinate end)
		{
			path.Add(new CorePathInformation(start, end));
		}

		public override List<CorePathInformation> Path
		{
			get
			{
				return m_Path;
			}
		}
		public void Initialize()
		{
			if (m_Path != null)
				throw new Exception("Already initialized.");
			m_Path = BuildPath();
		}
	}
}
